<template>
	<div class="news">
		<div class="breadcrumbs">
			<div class="container">
				<div class="row">
					<div class="col-lg-4 col-sm-4">
						<h1>
							新闻资讯
						</h1>
					</div>
					<div class="col-lg-8 col-sm-8">
						<ol class="breadcrumb pull-right">
							<li>
								<a href="#">
									首页
								</a>
							</li>
							<li class="active">
								/新闻资讯
							</li>
						</ol>
					</div>
				</div>
			</div>
		</div>
		<!-- <div class="new" v-for="(item, i) in news" :key="i">
			<img :src="item.repImgId" alt="" class="newImg">
			<div class="new-content" @click="goDetails(item)">
				<h2 class="new-title">{{item.title}}</h2>
			</div>
		</div> -->

		<div class="new" v-for="(item, i) in news" :key="i">
			<div style="width: 100%;background-color: #F8F8F8;display: flex;padding: 10px;margin-top: 5px;">
				<div style="width: 120px;height: 100px;">
					<img :src="item.repImgId" alt="" class="newImg">
				</div>
				<div class="new-content" @click="goDetails(item)">
					<div style="width: calc(100% - 120px);padding: 10px;display: flex;">
						<div style="width: calc(100% - 200px);font-size: 13px;font-weight: 600;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 4;overflow: hidden;">
							<h2 class="new-title">{{item.title}}</h2>
						</div>
						<div style="width: 200px;position: relative;">
							<div style="position: absolute;top: 0;right: -15px;font-size: 17px;transform: scale(0.8);white-space: nowrap;">
								<img src="../assets/images/1.png" style="height: 30px;width: 30px;" />发布时间：{{item.updateTime}}</div>
							<div style="position: absolute;bottom: 0;right: 0;background-color: white;border-radius: 3px;padding: 3px 10px;font-size: 12px;color: #555555;font-weight: 600;    margin-bottom: -23%">查看详情</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	import {
		CASE_API
	} from "../utils/api"
	export default {
		data() {
			return {
				news: []
			}
		},
		methods: {
			async getNews() {
				let {
					data
				} = await CASE_API({
					artical: "123"
				})
				data.list.forEach(item => {
					if (item.parentId === null) {
						this.news.push(item)
					}
				})
				console.log(this.news)
			},
			goDetails(item) {
				this.$router.push({
					path: '/news-details',
					query: {
						data: item
					}
				})
			}
		},
		created() {
			this.getNews()
		}
	}
</script>

<style lang="less" scoped>
	.breadcrumbs {
		background: #34495e;
		color: #fff;
		padding: 30px 0;
		margin-bottom: 40px;
		width: 1903px;
		margin-left: -352px;
		height: 28px;
	}

	.breadcrumbs h1 {
		font-size: 24px;
		font-weight: 600;
		margin: 3px 0 0;
		text-transform: uppercase;
		margin-left: 19%;
		margin-top: 0%;
	}

	.breadcrumb {
		margin-bottom: 0;
		background: none;
		font-size: 16px;
		margin-left: 75%;
		margin-top: -23px;
	}

	.breadcrumb li a {
		color: #48cfad;
	}

	.breadcrumb li.active {
		color: #fff;
	}


	.breadcrumb>li {
		display: inline-block;
	}

	.news {
		width: 1200px;
		margin: 20px auto;
	}

	.new {
		display: flex;
		justify-content: space-between;
		margin-bottom: 20px;
	}

	.newImg {
		/* width: 200px;
		height: 200px; */
		height: 107px;
		width: 128%;
		margin-right: 40px;
	}

	.new-content {
		flex: 1;
		cursor: pointer;
	}

	.new-title {
		/* text-align: center; */
		font-size: 24px;
		color: #797979;
		font-weight: 400;
		padding-left: 10%;
	}
</style>
